﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Framework.Common;
using Framework.IOC;
using Framework.Owin;
using Framework.Owin.WebApiSecurity;
using Owin;

namespace Application.WebAPI
{
    public partial class Startup
    {
        public void ConfigureIpLimit(IAppBuilder app)
        {
            Func<string, List<VisitLog>> getIpListfFunc = RedisHelp.GetIPListValue<List<VisitLog>>;
            Action<string, List<VisitLog>> setIpListAction = RedisHelp.SetIPList;
            Action<string> delIpListAction = RedisHelp.DelIPList;
            Func<string, IpBlack> getIpBlackFunc = RedisHelp.GetIpBlackListValue<IpBlack>;
            Action<string, IpBlack> setIpBlackAction = RedisHelp.SetIpBlackList;
            Action<string> delIpBlackAction = RedisHelp.DelIpBlackList;

            app.UseIpLimit(getIpListfFunc, setIpListAction, delIpListAction, getIpBlackFunc, setIpBlackAction, delIpBlackAction);
        }
    }
}